package book.nettyinaction.ch06;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;


/**
 * 代码清单 6-10 可共享的 ChannelHandler
 */
@ChannelHandler.Sharable
public class SharableHandler extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        System.out.println( "Channel read message: " + msg );

        // 记录方法调用，并转发给下一个 ChannelHandler
        ctx.fireChannelRead( msg );
    }
}
